package com.spring.boot.sample.test2.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 配置自定义资源映射
* <p>Title:MyWebAppConfigurer </p>
* <p>Description: </p>
* <p>Company: </p> 
* @author kexl
* @date 下午2:37:38
 */
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter{

	/**
	 * ①其中 addResourceLocations 的参数是动参，可以这样写 addResourceLocations(“classpath:/img1/”, “classpath:/img2/”, “classpath:/img3/”);
	 * ②可以直接使用addResourceLocations 指定磁盘绝对路径，同样可以配置多个位置，注意路径写法需要加上file:
	 */
	public void addResourceHandlers(ResourceHandlerRegistry registry){
		
		registry.addResourceHandler("/myres/**").addResourceLocations("classpath:/myres/","file:d:/qrcode/");
		super.addResourceHandlers(registry);
	}
}
